package com.yx.api.sys;

import com.yx.api.sys.factory.RemoteLogFallbackFactory;
import com.yx.common.core.constant.SecurityConstants;
import com.yx.common.core.constant.ServiceNameConstants;
import com.yx.common.core.domain.R;
import com.yx.common.core.domain.SysOperLog;
import com.yx.common.core.domain.entity.UserInfoCore;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 日志服务
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
{
    /**
     * 保存系统日志
     *
     * @param sysOperLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/sys/log")
    R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取所有用户基本信息
     * @return 结果
     */
    @GetMapping(value = "/sys/user/getAllUserInfo")
    Map<Integer, UserInfoCore> getAllUserInfo();


    /**
     * 获取所有用户基本信息
     * @return 结果
     */
    @GetMapping(value = "/sys/user/getUserInfoByUserName")
    Map<String, UserInfoCore> getUserInfoByUserName(@RequestParam(value = "userNameList") List<String> userNameList);

}
